import {MonsterUiState} from "db://assets/Scripts/MVC/Monster/MonsterUiState";
import {MonsterType} from "db://assets/Scripts/MVC/Monster/MonsterType";

/**
 * 敌人ViewModel
 */
export class MonsterViewModel {
    /**
     * 敌人UiState
     */
    public uiState: MonsterUiState = new MonsterUiState();

    /**
     * 判断敌人是否存活
     */
    public isLive(): boolean {
        return this.uiState.hp > 0;
    }

    /**
     * 重置状态
     */
    public reset() {
        // 生命值
        this.uiState.hp = 1;
        // 速度
        this.uiState.speed = 1;
        // 最大范围
        this.uiState.outRange = 10;
        // 飞机类型
        this.uiState.type = MonsterType.NORMAL;
        // 攻击间隔
        this.uiState.attackInterval = 0.3;
        // 当前攻击间隔
        this.uiState.currentAttackInterval = 0;
        // 是否处于保护期
        this.uiState.protective = true;
    }
}